package com.atguigu.lease.web.admin.service.impl;

import com.atguigu.lease.model.enums.BaseStatus;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atguigu.lease.model.entity.SystemPost;
import com.atguigu.lease.web.admin.service.SystemPostService;
import com.atguigu.lease.web.admin.mapper.SystemPostMapper;
import org.springframework.stereotype.Service;

/**
 * @author liubo
 * @description 针对表【system_post(岗位信息表)】的数据库操作Service实现
 * @createDate 2023-07-24 15:48:00
 */
@Service
public class SystemPostServiceImpl extends ServiceImpl<SystemPostMapper, SystemPost>
        implements SystemPostService {

    @Override
    public IPage<SystemPost> pageSystemPost(long current, long size) {
        Page<SystemPost> page = new Page<>(current, size);
        return this.page(page);
    }

    @Override
    public void updateStatusByPostId(Long id, BaseStatus status) {
        LambdaUpdateWrapper<SystemPost> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(SystemPost::getId, id)
                .set(SystemPost::getStatus, status);
        this.update(updateWrapper);
    }


}




